#ifndef _CUDA_BASE_UTILS_CUH_
#define _CUDA_BASE_UTILS_CUH_

#include <cstdio>
#include <cstdlib>
namespace cuda_utils{

    /* 
       this function is used for consistent checking of template parameter
       when template parameter is invalid, the template function will invoke this function
       and compiler will report error
     */
    template<int err>
    inline void invalid_template_parameter();

    inline void error( const char *msg ){
        fprintf( stderr,"%s\n", msg );
        exit( -1 );
    }

    // error function in device 
    // currently this is empty
    __device__ void error_device(){
#ifdef __DEVICE_EMULATION__
        fprintf( stderr,"error in device\n" );
        exit( -1 );
#endif
    }
};

#endif

